fix: remove arbitrary 0.1 OPG floor from LLM.ensure_opg_approval() — validate positive only#222
Open
amathxbt wants to merge 1 commit intoOpenGradient:mainfrom
Open
Conversation
…alidate positive only
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🐛 Bug:
LLM.ensure_opg_approval()Rejects Validmin_allowanceValuesFile:
src/opengradient/client/llm.py—LLM.ensure_opg_approval()What's broken
LLM.ensure_opg_approval()enforces an arbitrary minimum of 0.1 OPG on themin_allowanceparameter:But the underlying
opg_token.ensure_opg_approval()function has no such restriction — it accepts any positive value. This creates a split where:min_allowance=0.05) work fine when callingopg_token.ensure_opg_approval()directlyllm.ensure_opg_approval(min_allowance=0.05)raises aValueErrorthat's not actually required by the protocolThis 0.1 floor is an undocumented internal constraint with no technical basis, and is inconsistent with PR #201 which changed the hint constant to reference
0.05 OPG.Fix
Replace the arbitrary floor with a simple positive-number guard (the only invariant that actually matters):
Updated docstrings to remove references to the obsolete
0.1minimum.Impact
llm.ensure_opg_approval(min_allowance=0.05)→ValueErroropg_tokenlayerFiles Changed
src/opengradient/client/llm.py